package com.hqx.oop.myabstract;

import com.hqx.oop.destoryinherit.IAdd;

public class Base extends AbstractAdder {
    private static final int MAX_NUM = 1000;
    private int[] arr = new int[MAX_NUM];
    private int count;
    private long sum;
    @Override
    public void add(int number){
        if(count<MAX_NUM){
            arr[count++] = number;
        }
        sum += number;
    }
//    public void addAll(int[] numbers){
//        for(int num : numbers){
//            add(num);
//        }
//    }

    public void clear(){
        for(int i=0;i<count;i++){
            arr[i]=0;
        }
        count = 0;
    }

    public long getSum() {
        return sum;
    }
}
